Cannot convert the value in attribute '[attr]' to object of type 'System.Windows.TemplateBindingExte

Posted by Krimson on Stack Overflow See other posts from Stack Overflow or by Krimson
Published on 2010-04-09T14:02:43Z Indexed on 2010/04/12 8:33 UTC
Read the original article Hit count: 760

Hi,

I get this error when I define my attached dependency properties in a class outside the class hierarchy and set the owner to a common parent class.

Attached dependency property in WindowBase class (outside class hierarchy => generated error):

public static readonly DependencyProperty AreaColorProperty =
DependencyProperty.RegisterAttached("AreaColor", typeof(AreaColor), typeof(Window));

TemplateBinding that fails

{TemplateBinding local:WindowBase.AreaColor}

If I instead define the attached dependency property in a class within the class heirarchy and set the owner to this class, then I don't get any errors, why is this?

Attached dependency property in WindowBase (within class hierarchy => no errors):

public static readonly DependencyProperty AreaColorProperty =
DependencyProperty.RegisterAttached("AreaColor", typeof(AreaColor), typeof(WindowBase));

Best Regards, Jesper

© Stack Overflow or respective owner

Related posts about wpf

Related posts about attachedproperties